<template>
    <div class="table_wrapper">
        <div class="user_section">
            <div class="user_header">
                 <div class="user_avatar">
                     {{userInfo.nickName?userInfo.nickName.substring(0,1):""}}
                 </div>
                  <div class="user_content">
                      <div class="user_name">
                          {{getTime()}}！{{userInfo.nickName}}
                      </div>
                      <div class="user_login">
                          上次登录时间：{{userInfo.lastLoginTime}}
                      </div>
                  </div>
            </div>
        </div>

    </div>
</template>

<script>
    import {selectUserInfo} from "../../../api/base/user";

    export default {
        name: "index",
        data(){
          return{
              userInfo:{}
          }
        },
        created(){
            selectUserInfo().then(res=>{
                if(res.status===0){
                   this.userInfo=res.data;
                }
            })
        },
        methods:{
            getTime(){
               let hours= new Date().getHours();
               if(hours<12){
                   return "上午好";
               }
                if(hours<18){
                    return "下午好";
                }
                if(hours<12){
                    return "晚上好";
                }
            }
        }
    }
</script>

<style scoped lang="sass">
    @import "../../../styles/table"
    @import "index"
</style>
